﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
namespace SQT.tracnghiem.Ajax.ASP.Events
{
    public partial class tttn_wrong : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int event_id = int.Parse(Request.QueryString["event_id"]);
            int question_id = int.Parse(Request.QueryString["question_id"]);
            int type = int.Parse(Request.QueryString["type"]);
            var get_event_room = new TblEventRoomController().FetchAll().Where(x => x.EventId == event_id && x.GameId == question_id && x.GameType == type);
            var get_event_detail = new TblEventDetailController().FetchAll().Where(x => x.EventId == event_id);
            if(get_event_room.ToList().Count!=0)
                new TblEventRoomController().Destroy(get_event_room.Single().Id);
            new TblEventDetailController().Update(get_event_detail.Single().Id, null, null, null, null, 1);
        }
    }
}